#!/bin/bash
WORKDIR=/scratch/lustreC/h/he202/RUN4/ #### work dir
NJobs=10  #### total number of jobs
step=1  #### files number per job
for((k=0;k<$NJobs;k++)); do

cat >>mySUB$k  <<EOF
#PBS -l nodes=1,walltime=10:00:00
#PBS -N real_mult31 
#PBS -o /home/he202/Logfile/test$k.log
#PBS -e /home/he202/Logfile/test$k.err
#PBS -r n
#PBS -V
#PBS -q fqwang



echo Working directory is $PBS_O_WORKDIR
cd $PBS_O_WORKDIR
echo Running on host `hostname`
echo Time is `date`
echo Directory is `pwd`
cp -r /home/he202/Test-AuAu-1evt /scratch/lustreC/h/he202/RUN1/test$k 
cd /scratch/lustreC/h/he202/RUN1/test$k
module load devel
module load intel
PBS_JOBID=\`echo \$PBS_JOBID |  sed -ne "/^[0-9]/ {s/[. ].*//;p}"\`
sed "s#314159#\${PBS_JOBID}#" input.ampt_b > input.ampt
echo \${PBS_JOBID} > nseed_runtime_
make
sh exec 
rm ana/zpc.dat
rm ana/ampt.dat
EOF
qsub mySUB$k
done
